package com.my.user.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.my.user.entity.User;
import com.my.user.service.UserService;
import com.my.user.service.UserServiceImpl;



@WebServlet("/LandingAction")
public class LandingAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
  


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		User user=new User();
		String name=request.getParameter("uName");
		String password=request.getParameter("uPassword");
		user.setuName(name);
		user.setuPassword(password);

		UserService us=new UserServiceImpl();
		User user1=us.landingUser(user);
		if(user1==null){
			request.getRequestDispatcher("landerror.jsp").forward(request,response);
			
		}else{
			request.setAttribute("user1",user1);
			request.getRequestDispatcher("welcomelanding.jsp").forward(request,response);
		}
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
